package com.gitee.feizns.explore.data_structure.recursive.linked;

/**
 * @author feizns
 * @since 2019/11/12
 */
public class LinkedList {

    public static void main(String[] args) {
        ListNode node = new ListNode(new int[]{1, 2, 3, 2});
        System.out.println(removeElements(node, 2));
    }

    public static ListNode removeElements(ListNode node, int val) {
        if ( node != null ) {
            node.next = removeElements(node.next, val);
            return node.val == val ? node.next : node;
        }
        return null;
    }

}
